package com.kgc.novel.controller;

import com.kgc.novel.common.Res;
import com.kgc.novel.domain.param.BookManageParam;
import com.kgc.novel.service.book.BookManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/book/manage")
@Slf4j
@Api(tags = "小说接口")
public class BookManageController {

    @Resource
    private BookManageService bookManageService;

    @ApiOperation("模糊查询所有小说接口有分页")
    @GetMapping("/list")
    public Res selectList(@RequestBody BookManageParam bookManageParam){
        return bookManageService.selectBookManageAll(bookManageParam);
    }

    @ApiOperation("查看小说详情接口")
    @GetMapping("/details/{id}")
    public Res selectManageById(@PathVariable("id") String id){
        return bookManageService.selectBookManageById(id);
    }

    @ApiOperation("删除小说接口")
    @PutMapping("/delete/{id}")
    public Res deleteById(@PathVariable("id") String id){
        return bookManageService.deleteById(id);
    }

    @ApiOperation("审核通过和上架接口")
    @PutMapping("/updateStatus0/{id}")
    public Res updateStatus0(@PathVariable("id") String id){
        return bookManageService.updateStatus0(id);
    }

    @ApiOperation("下架小说接口")
    @PutMapping("/updateStatus1/{id}")
    public Res updateStatus1(@PathVariable("id") String id){
        return bookManageService.updateStatus1(id);
    }

    @ApiOperation("驳回审核接口")
    @PutMapping("/updateStatus3/{id}")
    public Res updateStatus3(@PathVariable("id") String id){
        return bookManageService.updateStatus3(id);
    }
}
